package com.renzhichu.app.polyv;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

public class RNTPolyvLive1 extends FrameLayout {
    public RNTPolyvLive1(Context context) {
        super(context);
    }

    public RNTPolyvLive1(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RNTPolyvLive1(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void requestLayout() {
        super.requestLayout();
        post(measureAndLayout);
    }

    private final Runnable measureAndLayout = new Runnable() {
        @Override
        public void run() {
            measure(
                    MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
            layout(getLeft(), getTop(), getRight(), getBottom());
        }
    };
}